<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/5/19
 * Time: 15:45
 */

namespace app\company\controller;


use app\admin\controller\Admin;
use app\admin\controller\DataNotFoundException;
use app\admin\controller\DbException;
use app\admin\controller\ModelNotFoundException;
use app\common\model\Dictionary as DictionaryModel;
use think\Exception;

class Dictionary extends Admin
{
    /**
     * 获取字典信息
     * @return void
     * @throws DataNotFoundException
     * @throws ModelNotFoundException
     * @throws DbException
     */
    public function getListByType()
    {
        $type = input('type');
        $param = [];
        if($type){
            $param['dictionary_type'] = ['in',$type];
        }
        $model = new DictionaryModel();
        $list = $model->where($param)->order('sort asc')->select();
        $arr = [
            'pay_type'=>[],
        ];
        foreach ($list as $item){
            if($item['dictionary_type'] == 1){
                $arr['pay_type'][] = $item;
            }
        }
        json_return_code($arr);
    }
}